#pragma once
#include <iostream>
#include <string>

using std::string;

string s("+-*/");

class task{
public:
    task(int a, int b, char ope)
        :_a(a)
        ,_b(b)
        ,_ope(ope)
    {}

    void run(){
        switch (_ope)
        {
        case '+':
            add();
            break;

        case '-':
            sub();
            break;

        case '*':
            mul();
            break;

        case '/':
            div();
            break;

        default:
            _exitcode = 2;
            printf("? # %d ? %d = error, exitcode = %d\n", _a, _b, _exitcode);
            break;
        }
    }

private:
    void add(){
        printf("add # %d + %d = %d, exitcode = %d\n", _a, _b, _a + _b, _exitcode);
    }

    void sub(){
        printf("sub # %d - %d = %d, exitcode = %d\n", _a, _b, _a - _b, _exitcode);
    }

    void mul(){
        printf("mul # %d * %d = %d, exitcode = %d\n", _a, _b, _a * _b, _exitcode);
    }

    void div(){
        if(_b == 0){
            _exitcode = 1;
            printf("div # %d / %d = error, exitcode = %d\n", _a, _b, _exitcode);
        }
        else{
            printf("div # %d / %d = %d, exitcode = %d\n", _a, _b, _a / _b, _exitcode);
        }
    }

private:
    int _a;
    int _b;
    char _ope;

    int _exitcode = 0;
};